package com.netcombine.freewill.manager;

import javax.servlet.http.HttpSession;

import com.netcombine.freewill.vo.FreewillVo;

public class SessionManager{
	
	private static final String LOGIN_INFO = "loginInfo";
	
	public static void logout(HttpSession session){
		
		session.invalidate();
	}

	public static void login(HttpSession session, FreewillVo memberVo){
		
		session.setAttribute(LOGIN_INFO, memberVo);
	}
	
	public static boolean isLogin(HttpSession session){
		
		FreewillVo memberVo = (FreewillVo)session.getAttribute(LOGIN_INFO);
		
		if(memberVo == null){
			
			return false;
		}
		
		return true;
	}
	
	/*
	public static boolean isAccess(HttpSession session, int needLevel){
		
		FreewillVo memberVo = (FreewillVo)session.getAttribute(LOGIN_INFO);
		
		if(memberVo == null){
			
			return false;
		}
		
		return (memberVo.getAdmin_level() <= needLevel) ? true : false;
	}
	*/
}